<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <h:outputStylesheet name="./css/cssLayout.css"/>
        <title>
            <ui:insert name="title">Facelets Template</ui:insert>
        </title>
    </h:head>

    <h:body>

        <ui:include src="./../dialogs/statusInformerDialogWindow.xhtml" />

        <h:outputStylesheet name="./css/components.css" />

        <div id="bodyContainer">
            <div id="top">
                <ui:insert name="top">

                    <h1 style="text-align: center;">
                        #{bundle.mainTitle}
                    </h1>

                    <a4j:outputPanel rendered="#{!loginBean.logedIn}"
                                     styleClass="loginLink" 
                                     onclick="#{rich:component('loginDialogWindow')}.show();"  >
                        <h:outputText value="#{bundle.loginHeader}" />
                    </a4j:outputPanel>

                    <h:form>    
                        <h:commandLink action="#{loginBean.logout}" 
                                       styleClass="loginLink"
                                       rendered="#{loginBean.logedIn}" >
                            <h:outputFormat value="#{bundle.logoutText}" >
                                <f:param value="#{loginBean.username}" />
                            </h:outputFormat>
                        </h:commandLink>
                    </h:form>

                </ui:insert>
            </div>

            <div id="left">
                <ui:insert name="left">
                    <h:form>
                        <rich:panelMenu activeItem="#{navigationMenuBean.selectedMenuItem}" itemMode="server" groupMode="client" groupExpandedLeftIcon="triangleUp"
                                        groupCollapsedLeftIcon="triangleDown" topGroupExpandedRightIcon="chevronUp"
                                        topGroupCollapsedRightIcon="chevronDown" itemLeftIcon="disc">
                            <rich:panelMenuGroup label="#{bundle.menuTeamModule}">
                                <rich:panelMenuItem label="#{bundle.menuViewSection}" name="#{navigationMenuBean.TEAM_VIEW_MENU_ITEM}" 
                                                    actionListener="#{navigationMenuBean.saveSelectedItem}" 
                                                    action="#{teamManagedBean.processActionAndRedirect('VIEW')}" />
                                <rich:panelMenuGroup label="#{bundle.menuManageGroupSection}" rendered="#{request.isUserInRole('Archiver')}" >
                                    <rich:panelMenuItem label="#{bundle.menuAddSection}" name="#{navigationMenuBean.TEAM_ADD_MENU_ITEM}" 
                                                        actionListener="#{navigationMenuBean.saveSelectedItem}" 
                                                        action="#{teamManagedBean.processActionAndRedirect('ADD')}" />
                                    <rich:panelMenuItem label="#{bundle.menuEditSection}" name="#{navigationMenuBean.TEAM_EDIT_MENU_ITEM}"
                                                        actionListener="#{navigationMenuBean.saveSelectedItem}" 
                                                        action="#{teamManagedBean.processActionAndRedirect('VIEW')}" />
                                </rich:panelMenuGroup>
                            </rich:panelMenuGroup>

                            <rich:panelMenuGroup label="#{bundle.menuPlayerModule}">
                                <rich:panelMenuItem label="#{bundle.menuViewSection}" name="#{navigationMenuBean.PLAYER_VIEW_MENU_ITEM}"
                                                    actionListener="#{navigationMenuBean.saveSelectedItem}" 
                                                    action="#{playerManagedBean.processActionAndRedirect('VIEW')}" />
                                <rich:panelMenuGroup label="#{bundle.menuManageGroupSection}" rendered="#{request.isUserInRole('Archiver')}" >
                                    <rich:panelMenuItem label="#{bundle.menuAddSection}" name="#{navigationMenuBean.PLAYER_ADD_MENU_ITEM}" 
                                                        actionListener="#{navigationMenuBean.saveSelectedItem}" 
                                                        action="#{playerManagedBean.processActionAndRedirect('ADD')}" />
                                    <rich:panelMenuItem label="#{bundle.menuEditSection}" name="#{navigationMenuBean.PLAYER_EDIT_MENU_ITEM}"
                                                        actionListener="#{navigationMenuBean.saveSelectedItem}" 
                                                        action="#{playerManagedBean.processActionAndRedirect('VIEW')}" />
                                </rich:panelMenuGroup>
                            </rich:panelMenuGroup>

                            <rich:panelMenuGroup label="#{bundle.menuMatchModule}">
                                <rich:panelMenuItem label="#{bundle.menuViewSection}" name="#{navigationMenuBean.MATCH_VIEW_MENU_ITEM}" 
                                                    actionListener="#{navigationMenuBean.saveSelectedItem}" 
                                                    action="#{matchManagedBean.processActionAndRedirect('VIEW')}" />
                                <rich:panelMenuGroup label="#{bundle.menuManageGroupSection}" rendered="#{request.isUserInRole('Archiver')}" >
                                    <rich:panelMenuItem label="#{bundle.menuAddSection}" name="#{navigationMenuBean.MATCH_ADD_MENU_ITEM}" 
                                                        actionListener="#{navigationMenuBean.saveSelectedItem}"  
                                                        action="#{matchManagedBean.processActionAndRedirect('ADD')}" />
                                    <rich:panelMenuItem label="#{bundle.menuEditSection}" name="#{navigationMenuBean.MATCH_EDIT_MENU_ITEM}"
                                                        actionListener="#{navigationMenuBean.saveSelectedItem}"  
                                                        action="#{matchManagedBean.processActionAndRedirect('VIEW')}" />
                                </rich:panelMenuGroup>
                            </rich:panelMenuGroup>

                        </rich:panelMenu>
                    </h:form>
                </ui:insert>
            </div>

            <div id="mainContent">
                <div id="content">
                    <ui:insert name="content"></ui:insert>
                </div>
            </div>

            <ui:include src="./../dialogs/loginDialogWindow.xhtml" />

            <div id="bottom">
                <ui:insert name="bottom">[PA165 FI MUNI] #{bundle.mainFooter}</ui:insert>
            </div>
        </div>
    </h:body>

</html>
